<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Session;
use App\Services\MemberService;

class MemberController extends Controller{
	public function list(Request $request){
		$username = Session::get('username');
		if(!$username){
			return redirect('/admin/login');
		}else{
			$data['page_size_list'] = array(20,25,50,100);
			$data['page_size'] = $request->input('page_size') ? intval($request->input('page_size')) : 20;
			$data['keywords'] = $request->input('keywords') ? addslashes($request->input('keywords')) : '';
			$data['username'] = $username;
			$member = new MemberService;

			$data['mlist'] = $member->getMemberList($data['page_size'],$data['keywords']);

			return view('admin.member.list',$data);
		}
	}
}